<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>话题详情</title>
	<link rel="stylesheet" href="./bootstrap/bootstrap.min.css">
	<script src="./jquery/jquery-3.5.1.min.js"></script>
	<script src="./bootstrap/bootstrap.min.js"></script>
</head>

<body>
	<h2 style="text-align: center;">话题详情</h2>
	<table class="table">
		<tbody id="table">
			<tr>
				<td>id</td>
				<td id="id">1</td>
			</tr>
			<tr>
				<td>作者</td>
				<td id="title">XXXXX</td>
			</tr>
			<tr>
				<td>内容</td>
				<td id="content">XXXXXsssss</td>
			</tr>
		</tbody>
	</table>

	<script>
		$(function () {
			var id = getQueryVariable("id");
			$.getJSON("./discuss/"+id, function (item) {
				console.log(item);
				$("#id").html(item.id);
				$("#title").html(item.title);
				$("#content").html(item.content);
			});
		});

		function getQueryVariable(variable) {
			var query = window.location.search.substring(1);
			var vars = query.split("&");
			for (var i = 0; i < vars.length; i++) {
				var pair = vars[i].split("=");
				if (pair[0] == variable) {return pair[1];}
			}
			return (false);
		}
	</script>
</body>

</html>